<template>
  <div>
    <el-table
      :data="classList"
      :stripe="true"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="编号">
      </el-table-column>
      <el-table-column
        prop="name"
        label="班级名称">
      </el-table-column>
      <el-table-column
        prop="teacher.name"
        label="辅导员">
      </el-table-column>

      <el-table-column
        prop="major"
        label="专业">
      </el-table-column>

      <el-table-column
        prop="description"
        label="描述">
      </el-table-column>

      <el-table-column
        label="操作">
        <template slot-scope="scope">
          <el-button @click="selectStudents(scope.row.id)">查看班级学生</el-button>
        </template>
      </el-table-column>
    </el-table>
    <router-view/>
  </div>
</template>

<script>
    export default {
        name: "classList",
      data(){
          return {
            classList:[]
          }
      },
      created(){
        this.selectAll();
      },
      methods: {
        selectStudents(id){
          this.$router.push("/student/StudentList?cid="+id);
        },
        selectAll(){
          this.axios.get("/class/selectAll").then((resp)=>{
            this.classList=resp.data;
          });
        }
      }
    }
</script>

<style scoped>

</style>
